@extends('admin.base')


@section('content')
<!-- Content Header (Page header) -->
    <section class="content-header">
          <h1>
           订单管理
            <small>preview of simple tables</small>
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">订单信息</a></li>
            <li class="active">订单列表</li>
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">
          <div class="row">
            <div class="col-md-12">
              <div class="box">
                  
                
             
                
                <div class="box-header with-border">
                  <h3 class="box-title"><i class="fa fa-th" style="margin-right: 1rem"></i> 订单信息管理</h3>
                 
                   
                  <div class="" style="display: inline-block;vertical-align: middle;">
                        <form style="display:inline-block;" action="{{url('order')}}" method="get">
                            <div class="input-group" style="width: 300px;">
                              <input type="text" name="name" class="form-control input-sm pull-right" style="width: 50%" placeholder="订单短信识别码号"/>
                             <input type="text" name="phone" class="form-control input-sm pull-right" style="width: 50%" placeholder="手机号"/>
                              <div class="input-group-btn">
                                <button class="btn btn-sm btn-default"><i class="fa fa-search"></i></button>
                              </div>
                            </div>
                        </form>
                     <button class="btn btn-sm btn-primary" style="float:right;" onclick="window.location='{{URL('excel/export')}}'">导出execel</button>
                  </div>
                </div><!-- /.box-header -->
                <div class="box-body">
                  <table class="table table-bordered" >
                    <tr >
                      <th>ID</th>
                      <th>姓名</th>
                      <th>订单号</th>
                      <th>金额</th>
                      <th>名称</th>
                      <th>支付时间</th>
                      <th>订单状态</th>
                      <th style="width: 170px">订单码</th>
                       <th style="width: 170px">用户手机号</th>
                    </tr>
                    @foreach($list as $vo)
                        <tr id="tr{{ $vo->id}}">
                             <td>{{ $vo->id}}</td>
                            <td>{{ $vo->nickName}}</td>
                            <td>{{ $vo->out_trade_no}}</td>
                            <td>{{ $vo->price}}</td>
                            <td>{{ $vo->name}}</td>
                            <td>{{date('Y-m-d H:i:s',$vo->paytime)}}</td>
                            <td><select class="form-control" onchange="selectOnchang({{$vo->id}})">
                                    @if($vo->status==1)
                                         <option>已付款</option>
                                    
                                   @endif
                                    <option>完成</option>

                            </td>
                            <td>{{$vo->phone_code}}</td>
                              <td>{{$vo->phone}}</td>  
                        </tr>
                    @endforeach
                    
                  </table>
                </div><!-- /.box-body -->
                <div class="box-footer clearfix">
                    {!! $list->appends($params)->render() !!}
                </div>
              </div><!-- /.box -->

            </div><!-- /.col --> 
          </div><!-- /.row -->
        </section><!-- /.content -->
        
    @endsection
    
    @section('myscript')
    <form action="/users/" method="post" name="myform" style="display:none;">
            <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
            <input type="hidden" name="_method" value="delete"/>
           
    </form>
    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
        <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="exampleModalLabel">New message</h4>
          </div>
          <div class="modal-body">
           <!-- 此处填充 -->
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            <button type="button" onclick="saveRole()" class="btn btn-primary">保存</button>
          </div>
        </div>
      </div>
    </div>
    <script type="text/javascript">
        function doDel(id){
            Modal.confirm({msg: "是否删除信息？"}).on(function(e){
                if(e){
                   var form = document.myform;
                    form.action = "{{URL('users')}}/"+id;
                    form.submit(); 
                }
              });
        }
        
        function selectOnchang(obj)
        {
            
            $.ajax({
                url:"{{URL('order/swoole')}}/"+obj,
                type:"get",
                dataType:"html",
                async:true,
                success:function(data){
                   if(data==200){
                       $("#tr"+obj).hide();
                   }
                },
             });
        }
       
    </script>
    @endsection